<template>
  <div ref="sponsorRef" class="sponsor-box-wraper">
    <introduce-title-vue
        title="博客开源代码"
        subtitle="开源代码、本地运行、部署、上线一条龙！"
        title-color="#000"
        subtitle-color="#7f8b96"
    ></introduce-title-vue>

    <div class="sponsor-content-box">
      <div class="top" >
        <img src="@/assets/images/blog.jpg" alt="开源博客地址" style="width: 45vw"/>
      </div>
        <div class="bottom">
        <div class="button" @click="openSponsorDialog"> 演示地址 </div>
      </div>
    </div>


  </div>
</template>

<script lang="ts" setup>
import CONFIG from '@/config';
import { FormInstance, FormRules, UploadProps } from 'element-plus';
import IntroduceTitleVue from '@/views/index/components/IntroduceTitle.vue';
import appStore from '@/store';

// 出现在可视区
const sponsorRef = ref<any>(null);
const scrollIntoView = () => {
  sponsorRef.value.scrollIntoView({ behavior: 'smooth' });
};

// 上传文件地址
const uploadAddress = () => {
  return CONFIG.serverAddress + '/huajian/upload/file/logo';
};

const beforeLogoUpload: UploadProps['beforeUpload'] = (rawFile) => {
  if (rawFile.size / 1024 / 1024 > 5) {
    ElMessage.error('logo不能大于5M');
    return false;
  }
  return true;
};


defineExpose({
  scrollIntoView
});

</script>
<style lang="scss" scoped>
.sponsor-box-wraper {
  background-color: #fff;
  .sponsor-content-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    min-height: 10vh;
    .top {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      img {
        width: 20vw;
      }
    }
    .sponsor-list-box {
      display: flex;
      align-items: center;
      ul {
        display: flex;
        li {
          width: 150px;
          height: 180px;
          list-style: none;
          box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
          margin: 12px;
          cursor: pointer;
          display: flex;
          flex-direction: column;
          transition: 0.15s all ease-in-out;
          border-radius: 8px;
          &:hover {
            transform: scale(1.1);
          }
          .img-box {
            width: 100%;
            height: 70%;
            display: flex;
            align-items: center;
            justify-content: center;
            img {
              width: 80%;
            }
          }
          .name-box {
            width: 100%;
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            p {
              color: #03a9f4;
              font-size: 20px;
              white-space: nowrap;
              text-overflow: ellipsis;
              overflow: hidden;
              padding: 0 5px;
            }
          }
        }
      }
    }
    .bottom {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 150px;
      .button {
        width: 160px;
        height: 52px;
        line-height: 52px;
        background-color: #00c090;
        text-align: center;
        color: #fff;
        font-size: 16px;
        border-radius: 52px;
        cursor: pointer;
        -webkit-transition: all 0.2s;
        -moz-transition: all 0.2s;
        -ms-transition: all 0.2s;
        transition: all 0.2s;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        &:hover {
          opacity: 0.8;
        }
      }
    }
  }
}
</style>
